<extend name="Base/common" />


<block name="body">

 <div class="center">
        	<div class="box">
           	  <div class="title">用户注册</div>
             	<div id="enroll"><!--__SELF__-->
        <form class="login-form" action="#" method="post" ">
		<ul>
          <li><div class="control-group">
            <span class="control-label" for="inputName">用户名</span>
            <div class="controls">
              <input type="text" id="inputName" onblur="check_len(this)" class="span3" placeholder="请输入用户名"  ajaxurl="/member/checkUserNameUnique.html" errormsg="请填写1-16位用户名" nullmsg="请填写用户名" datatype="*1-16" value="" name="username">
            </div>
			<font id="show_name"></font>
          </div></li>
		  <li>
          <div class="control-group">
            <span class="control-label" for="inputPassword">密码</span>
            <div class="controls">
              <input type="password" id="inputPassword"  onblur="pw_len(this)" class="span3" placeholder="请输入密码"  errormsg="密码为6-20位" nullmsg="请填写密码" datatype="*6-20" name="password">
            </div>
			<font id="show_pw"></font>
          </div></li>
		  <li>
          <div class="control-group">
            <span class="control-label" for="inputPassword">确认密码</span>
            <div class="controls">
              <input type="password" id="inputPassword2" onblur="pw2_len(this)" class="span3" placeholder="请再次输入密码" recheck="password" errormsg="您两次输入的密码不一致" nullmsg="请填确认密码" datatype="*" name="repassword">
            </div>
			<font id="show_pw2"></font>
          </div>
		  </li>
		  <li>
          <div class="control-group">
            <span class="control-label" for="inputEmail">手机号码</span>
            <div class="controls">
              
			  <input type="text" id="inputMobile" onblur="shouji_len(this)" placeholder="请输入手机号码"   datatype="m" value="" name="mobile">
            
			</div>
			
			<a href="#" >获取验证码</a>
			
          </div></li>
		  <li>
          <div class="control-group">
            <span  for="inputVerify">验证码</span>
            <div class="controls">
              <input type="text" id="verify"  placeholder="请输入验证码"  errormsg="请填写5位验证码" nullmsg="请填写验证码" datatype="*5-5" name="verify">
            </div>
			<font id="show_sj"></font>
          </div>
		 
		  </li>
		   <li><span></span><font class=" Validform_checktip "></font></li>
		  <!--<li>
          
            <span class="control-label"></span>
            <div >
                <img class="verifyimg reloadverify" alt="点击切换" src="{:U('verify')}" style="cursor:pointer;">
            </span>
            <div class=" Validform_checktip "></div>
          </div>
		  </li>-->
		  </ul>
          </div>
              <button type="submit" class="submit">注 册</button>
			
          
        </form>
	</div>


</block>

<block name="side"> </block>
<block name="script">
<script type="text/javascript" src="__STATIC__/jquery-2.0.3.min.js"></script>
<script>


function check_len(thisObj){
   
    if (thisObj.value.length<2 || thisObj.value.length>16)
     {
         document.getElementById('show_name').innerHTML="<img src='__IMG__/en_1.jpg'/> 用户名长度必须在4-16个字符以内！";
        return false;
    }
         document.getElementById('show_name').innerHTML="<img src='__IMG__/dui.png'/>";    
         return true;
       }
	   function pw_len(thisObj){
   
    if (thisObj.value.length<6 || thisObj.value.length>30)
     {
         document.getElementById('show_pw').innerHTML="<img src='__IMG__/en_1.jpg'/> 密码长度必须在6-30个字符以内！";
        return false;
    }
         document.getElementById('show_pw').innerHTML="<img src='__IMG__/dui.png'/>";    
         return true;
       }
 function pw2_len(thisObj){
   $a = document.getElementById('inputPassword').value;
   if($a!==''){
    if (thisObj.value!=$a)
     {
         document.getElementById('show_pw2').innerHTML="<img src='__IMG__/en_1.jpg'/> 密码和确认密码不一致！";
        return false;
    }
         document.getElementById('show_pw2').innerHTML="<img src='__IMG__/dui.png'/>";    
         return true;
       }
	   }
 
  function shouji_len(thisObj){
    var reg=/^1[3|5|7|8|9][0-9]\d{8}$/;    
     var rzt=thisObj.value.match(reg);
     
     if (rzt==null)
     {
         document.getElementById('show_sj').innerHTML="<img src='__IMG__/en_1.jpg'/> 请输入正确的手机号码！";
        return false;
     }else{
         document.getElementById('show_sj').innerHTML="<img src='__IMG__/dui.png'/>";
        return true;
    }

  }
    function dizhi_len(thisObj){
  
     if(thisObj.value.length==0){
        document.getElementById('show_dz').innerHTML="地址不能为空";
         return false;
         }else{
    
         document.getElementById('show_dz').innerHTML="";
        return true;
    }

  }
   function dizhi_xx(){
  
   
        document.getElementById('address').innerHTML="";
        

  }

    	$(document)
	    	.ajaxStart(function(){
	    		$("button:submit").addClass("log-in").attr("disabled", true);
	    	})
	    	.ajaxStop(function(){
	    		$("button:submit").removeClass("log-in").attr("disabled", false);
	    	});


    	$("form").submit(function(){
    		var self = $(this);
    		$.post(self.attr("action"), self.serialize(), success, "json");
    		return false;

    		function success(data){
			  

    			if(data.status){
    				window.location.href = data.url;
    			} else {
				if(data.info.res==1){
    				self.find("#show_name").html("<img src='__IMG__/en_1.jpg'/>  "+data.info.errer);
    				//刷新验证码
    				//$(".reloadverify").click();
					}else if(data.info.res==2){
					self.find("#show_pw").html("<img src='__IMG__/en_1.jpg'/>  "+data.info.errer);
					}
					else if(data.info.res==3){
					self.find("#show_sj").html("<img src='__IMG__/en_1.jpg'/>  "+data.info.errer);
					}
    			}
    		}
    	});

		/*$(function(){
			var verifyimg = $(".verifyimg").attr("src");
            $(".reloadverify").click(function(){
                if( verifyimg.indexOf('?')>0){
                    $(".verifyimg").attr("src", verifyimg+'&random='+Math.random());
                }else{
                    $(".verifyimg").attr("src", verifyimg.replace(/\?.*$/,'')+'?'+Math.random());
                }
            });
		});*/

	</script>
</block>
